﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Share_Adv : System.Web.UI.UserControl
{
    private string anhTrai = "";
    private string anhPhai = "";
    private string anTrai = "";
    private string anPhai = "";
    private string linkTrai = "";
    private string linkPhai = "";

    public string AnhTrai
    {
        get { return anhTrai; }
        set { anhTrai = value; }
    }

    public string AnhPhai
    {
        get { return anhPhai; }
        set { anhPhai = value; }
    }

    public string AnTrai
    {
        get { return anTrai; }
        set { anTrai = value; }
    }

    public string AnPhai
    {
        get { return anPhai; }
        set { anPhai = value; }
    }
    public string LinkTrai
    {
        get { return linkTrai; }
        set { linkTrai = value; }
    }
    public string LinkPhai
    {
        get { return linkPhai; }
        set { linkPhai = value; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!Page.IsPostBack)
        {
            CommonDAO cm = new CommonDAO();
            DataTable tb = cm.queryForTable("select top(1) isnull(anhtrai,'') as anhtrai,isnull(anhPhai,'') as anhPhai,isnull(antrai,'') as antrai,isnull(anPhai,'') as anPhai,isnull(LinkTrai,'#') as linkTrai,isnull(linkPhai,'#') as linkPhai from QuangCao_HaiBen", "t");
            if (null != tb)
            {
                if (tb.Rows.Count > 0)
                {
                    anhTrai= tb.Rows[0]["AnhTrai"].ToString();
                    if(anhTrai.StartsWith("../"))
                    {
                        anhTrai = anhTrai.Substring(3);
                    }
                    anTrai = tb.Rows[0]["anTrai"].ToString().Equals("1") ? "none" : "block";

                    anhPhai = tb.Rows[0]["anhPhai"].ToString();
                    if (anhPhai.StartsWith("../"))
                    {
                        anhPhai = anhPhai.Substring(3);
                    }
                    anPhai = tb.Rows[0]["anPhai"].ToString().Equals("1") ? "none" : "block";
                    linkTrai = tb.Rows[0]["linkTrai"].ToString();
                    linkPhai = tb.Rows[0]["linkPhai"].ToString();
                }
            }
        }
    }
}
